﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
		<c:set var="ctx" value="${pageContext.request.contextPath}" />
		<html>

		<head>
			<link rel="stylesheet" href="${ctx}/common/common.css">
			<meta charset="utf-8">
			<title>工艺管理详细</title>
			<meta name="renderer" content="webkit">
			<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
			<meta name="viewport"
				content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
			<link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
			<link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/modules/layer/default/layer.css"
				media="all">
			<link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
			<script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>

			<script src="${ctx}/common/plugins/layuiadmin/layui/lay/modules/layer.js"></script>
			<style>
				.layui-table-header {
					width: 100%;
				}

				.layui-table-header th {
					width: 20%;
					text-align: center;
				}

				.layui-products {
					border-bottom: 2px solid #e7e7e7;
					/*border-top: 2px solid #e7e7e7;*/
					margin: 10px 0px;
					padding: 5px 0px;
				}

				.layui-products_li {
					margin-left: 50px;
					border-bottom: 1px dashed #e7e7e7;
				}

				.layui-products_li:first-child {
					border: none;
				}

				.layui-col-md4 img {
					margin-right: 5px;
					width: 22px;
					height: 22px;
				}

				.layui-col-md4 img {
					margin-right: 5px;
					width: 22px;
					height: 22px;
				}

				.valtop {
					padding: 9px
				}

				.layui-layer-dialog {
					top: 150px !important;
				}
			</style>
		</head>

		<body>
			<!--主体内容层-->
			<form class="layui-form layui-col-md12" action="${ctx}/inspStandard/inspStandardSave">
				<div class="layui-fluid">
					<div class="layui-row layui-col-space15">
						<input type="hidden" id="pId" name="pId" value="${product.id }">
						<!--输入框内容盒子-->
						<div class="layui-col-md12">
							<div class="layui-form-item layui-col-md3">
								<label class="layui-form-label">产品编码：</label>
								<div class="layui-input-block valtop">${product.standardNum }</div>
							</div>
							<div class=" layui-col-md3">
								<label class="layui-form-label">产品名称：</label>
								<div class="layui-input-block valtop">${product.name }</div>
							</div>
							<div class=" layui-col-md3">
								<label class="layui-form-label">规格：</label>
								<div class="layui-input-block valtop">${product.specifications }</div>
							</div>
							<div class=" layui-col-md3">
								<label class="layui-form-label">单位：</label>
								<div class="layui-input-block valtop">${product.unit }</div>
							</div>
						</div>
					</div>
					<c:forEach items="${productProcess }" var="pro">
						<div class="layui-col-md12" style="margin-top:2%">
							<div class=" layui-col-md6">
								<label class="layui-form-label">工艺名称：</label>
								<div class="layui-input-block valtop">${pro.name }</div>
							</div>
							<div class=" layui-col-md6">
								<label class="layui-form-label">排序<span style="color: red">*</span>：</label>
								<input name="sort" onblur="check(this.value)" value="${pro.sort }" class="layui-input"
									style="width:50%; position: relative;z-index: 10;">
								<input name="tId" type="hidden" value="${pro.id }" class="layui-input">
							</div>
						</div>
						<div class="layui-card">
							<div id="addCard" class="layui-card-body"
								style="padding: 10px 0px; border-top: 1px solid #e7e7e7;">
								<c:forEach items="${pro.view }" var="technic">
									<div class="layui-row" style="border-bottom: 1px dashed #e7e7e7;">
										<div class="layui-row layui-col-space10 layui-products_li"
											style="border: none;">
											<div class="layui-col-md6 valtop">指标代码： ${technic.code }</div>
											<div class="layui-col-md6 valtop">采集方式：
												<c:if test="${technic.quota_type == 1 }">手工录入</c:if>
												<c:if test="${technic.quota_type == 2 }">设备采集</c:if>
											</div>
										</div>
										<div class="layui-row layui-col-space10 layui-products_li"
											style="border: none;">
											<div class="layui-col-md6 valtop">指标名称： ${technic.name }</div>
											<div class="layui-col-md6 valtop">是否公开：
												<c:choose>
													<c:when test="${technic.share_stat == 0 }">否</c:when>
													<c:otherwise>是</c:otherwise>
												</c:choose>
											</div>
										</div>
										<div class="layui-row layui-col-space10 layui-products_li"
											style="border: none;">
											<div class="layui-col-md6 valtop">指标单位： ${technic.unit }</div>
											<div class="layui-col-md6 valtop">是否必填：
												<c:choose>
													<c:when test="${technic.isInput == 0 }">否</c:when>
													<c:otherwise>是</c:otherwise>
												</c:choose>
											</div>
										</div>
										<div class="layui-row layui-col-space10 layui-products_li"
											style="border: none;">
											<div class="layui-col-md6 valtop">采集类型：
												<c:choose>
													<c:when test="${technic.gather_method == '1'}">字符</c:when>
													<c:when test="${technic.gather_method == '2'}">数值</c:when>
													<c:when test="${technic.gather_method == '3'}">日期</c:when>
													<c:when test="${technic.gather_method == '4'}">日期时间</c:when>
													<c:when test="${technic.gather_method == '5'}">图片</c:when>
													<c:when test="${technic.gather_method == '6'}">音视频</c:when>
												</c:choose>
											</div>
											<div class="layui-col-md6 valtop">描述： ${technic.described }
											</div>
										</div>
									</div>

								</c:forEach>
							</div>
						</div>
					</c:forEach>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button type="button" id="submit" class="layui-btn">保存</button>
							<button type="button" id="rollback" class="layui-btn layui-btn-primary">返回</button>
						</div>
					</div>
				</div>
			</form>
			<script type="text/javascript">
				document.getElementById("rollback").addEventListener("click",
					function () {
						window.history.back();
					});
				function check(value) {
					var number = /^[+]{0,1}(\d+)$/;
					if (!number.test(value)) {
						layer.alert("请输入正整数！");
						document.getElementById("submit").disabled = true;
					} else {
						document.getElementById("submit").disabled = false;
					}
				}
				document.getElementById("submit").addEventListener("click",
					function () {
						var sort = document.getElementsByName("sort");
						var tId = document.getElementsByName("tId");
						var pId = document.getElementById("pId").value;
						var sorts = "";
						var tIds = "";
						var ss = true;
						for (var i = 0, j = sort.length; i < j; i++) {
							if (sort[i].value == "") {
								ss = false;
							}
							sorts += sort[i].value + ",";
							tIds += tId[i].value + ",";
						}
						if (ss == false) {
							layer.alert("请输入工艺序号");
						} else {
							window.location.href = '${ctx}/productProcess/saveSort?pId=' + pId + '&tIds=' + tIds + '&sorts=' + sorts;
						}

					});
				layui.use(['jquery', 'layer'], function () {
					var $ = layui.$ //重点处
						, layer = layui.layer;

					$(document).on('click', '#editProcess', function () {
						var processId = document.getElementById("processId").value;
						//编辑页
						window.location.href = '${ctx}/process/processEdit?processId=' + processId;
					})
				});
			</script>
		</body>

		</html>